EMT Practice Test

1. Question Content...


Question List

Question1: terraform refresh command will not modify infrastructure, but does modify the state file.

Question2: Valarie has created a database instance in AWS and for ease of use is outputting the value of the database password with the following code. Valarie wants to hide the output value in the CLI after terraform apply that's why she has used sensitive parameter.
1. output "db_password" {
2. value = local.db_password
3. sensitive = true
4. }
Since sensitive is set to true, will the value associated with db password be available in plain-text in the state file for everyone to read?

Question3: Which of the following is not true of Terraform providers?

Question4: What is the name assigned by Terraform to reference this resource?

Question5: When using constraint expressions to signify a version of a provider, which of the following are valid provider versions that satisfy the expression found in the following code snippet: (select two)
1. terraform
2. {
3. required_providers
4. {
5. aws = "~> 1.2.0"
6. }
7. }

Question6: Which of the following statements about local modules is incorrect:

Question7: If you delete a remote backend from the configuration, will you need to rebuild your state files locally?

Question8: What does the command terraform fmt do?

Question9: When Terraform needs to be installed in a location where it does not have internet access to download the installer and upgrades, the installation is generally known as to be __________.

Question10: What is the result of the following terraform function call?

Question11: What is the purpose of a Terraform workspace in either open source of enterprise?

Question12: You should store secret data in the same version control repository as your Terraform configuration.

Question13: You have created a custom variable definition file my_vars.tfvars. How will you use it for provisioning infrastructure?

Question14: True or False. The terraform refresh command is used to reconcile the state Terraform knows about (via its state file) with the real-world infrastructure. If drift is detected between the real-world infrastructure and the last known-state, it will modify the infrastructure to correct the drift.

Question15: Your team uses terraform OSS . You have created a number of resuable modules for important , independent network components that you want to share with your team to enhance consistency . What is the correct option/way to do that?

Question16: terraform refresh command will not modify infrastructure, but does modify the state file.

Question17: What value does the Terraform Cloud/Terraform Enterprise private module registry provide over the public Terraform Module Registry?

Question18: Which of the below configuration file formats are supported by Terraform? (Select TWO)

Question19: You want to define multiple data disks as nested blocks inside the resource block for a virtual machine. What Terraform feature would help you define the blocks using the values in a variable?

Question20: You want terraform plan and apply to be executed in Terraform Cloud's run environment but the output is to be streamed locally. Which one of the below you will choose?

Question21: Which of the following is not a valid string function in Terraform?

Question22: ABC Enterprise has recently tied up with multiple small organizations for exchanging database information. Due to this, the firewall rules are increasing and are more than 100 rules. This is leading firewall configuration file that is difficult to manage. What is the way this type of configuration can be managed easily?

Question23: Terraform plan updates your state file.

Question24: What information does the public Terraform Module Registry automatically expose about published modules?

Question25: When does Sentinel enforce policy logic during a Terraform Enterprise run?

Question26: When using a module block to reference a module stored on the public Terraform Module Registry such as:

How do you specify version 1.0.0?

Question27: You have a Terraform configuration file where a variable itemNum is defined as follows:
variable "itemNum" { default = 3}
You also have a defined the following environment variables in your shell: TF_itemNum =6, TF_VAR_itemNum =9. You also have a terraform.tfvars file with the following contents itemNum = 7 When you run the following apply command, what is the value assigned to the itemNum variable?
terraform apply -var itemNum =4

Question28: Given the below resource configuration -
resource "aws_instance" "web" { # ... count = 4 }
What does the terraform resource address aws_instance.web refer to?

Question29: What does this code do?

Question30: Which of the following connection types are supported by the remote-exec provisioner? (select two)

Question31: What advantage does an operations team that uses infrastructure as code have?

Question32: What is the result of the following terraform function call?

Question33: You cannot publish your own modules on the Terraform Registry.

Question34: Refer to the below code where developer is outputting the value of the database password but has used sensitive parameter to hide the output value in the CLI.
output "db_password" { value = aws_db_instance.db.password description = "The password for logging in to the database." sensitive = true} Since sensitive is set to true, the value associated with db password will not be present in state file as plain-text?

Question35: You have provisioned some virtual machines (VMs) on Google Cloud Platform (GCP) using the gcloud command line tool. However, you are standardizing with Terraform and want to manage these VMs using Terraform instead.
What are the two things you must do to achieve this? (Choose two.)

Question36: Which of the following terraform subcommands could be used to remove the lock on the state for the current configuration?

Question37: During a terraform plan, a resource is successfully created but eventually fails during provisioning. What happens to the resource?

Question38: Forcing the recreation of a resource is useful when you want a certain side effect of recreation that is not visible in the attributes of a resource. What command will do this?

Question39: True or False? Each Terraform workspace uses its own state file to manage the infrastructure associated with that particular workspace.

Question40: Using multi-cloud and provider-agnostic tools provides which of the following benefits?

Question41: When you initialize Terraform, where does it cache modules from the public Terraform Module Registry?

Question42: Where in your Terraform configuration do you specify a state backend?

Question43: From the code below, identify the implicit dependency:

Question44: Anyone can publish and share modules on the Terraform Public Module Registry, and meeting the requirements for publishing a module is extremely easy. Select from the following list all valid requirements. (select three)

Question45: Your security team scanned some Terraform workspaces and found secrets stored in a plaintext in state files.
How can you protect sensitive data stored in Terraform state files?

Question46: You have a Terraform configuration file where a variable itemNum is defined as follows:
variable "itemNum" { default = 3}
You also have a defined the following environment variables in your shell: TF_itemNum =6, TF_VAR_itemNum =9. You also have a terraform.tfvars file with the following contents itemNum = 7 When you run the following apply command, what is the value assigned to the itemNum variable?
terraform apply -var itemNum =4

Question47: When configuring a remote backend in Terraform, it might be a good idea to purposely omit some of the required arguments to ensure secrets and other important data aren't inadvertently shared with others. What are the ways the remaining configuration can be added to Terraform so it can initialize and communicate with the backend? (select three)

Question48: Select the feature below that best completes the sentence:
The following list represents the different types of __________ available in Terraform.
1. max
2. min
3. join
4. replace
5. list
6. length
7. range

Question49: What is the command you can use to set an environment variable named "var1"of type String?

Question50: Complete the following sentence:
The terraform state command can be used to ____

Question51: During a terraform plan, a resource is successfully created but eventually fails during provisioning. What happens to the resource?

Question52: How does Terraform handle working with so many providers?

Question53: Which task does terraform init not perform?

Question54: resource "aws_s3_bucket" "example" { bucket = "my-test-s3-terraform-bucket" ...} resource "aws_iam_role" "test_role" { name = "test_role" ...} Due to the way that the application code is written , the s3 bucket must be created before the test role is created , otherwise there will be a problem. How can you ensure that?

Question55: Any user can publish modules to the public Terraform Module Registry.

Question56: terraform init retrieves the source code tot all referenced modules

Question57: Which of the following actions are performed during a terraform init?

Question58: How would you reference the "name" value of the second instance of this fictitious resource?

Question59: State locking does not happen automatically and must be specified at run

Question60: Which of the following statements best describes the Terraform list(...) type?

Question61: In contrast to Terraform Open Source, when working with Terraform Enterprise and Cloud Workspaces, conceptually you could think about them as completely separate working directories.

Question62: You have declared a variable name my_var in terraform configuration without a value associated with it.
variable my_var {}
After running terraform plan it will show an error as variable is not defined.

Question63: Which of the following is considered a Terraform plugin?

Question64: Terraform import command can import resources into modules as well directly into the root of your state.

Question65: Terraform works well in Windows but a Windows server is required.

Question66: Every region in AWS has a different AMI ID for Linux and these are keep on changing. What is the best approach to create the EC2 instances that can deal with different AMI IDs based on regions?

Question67: When TF_LOG_PATH is set, TF_LOG must be set in order for any logging to be enabled.

Question68: If you manually destroy infrastructure, what is the best practice reflecting this change in Terraform?

Question69: You cannot publish your own modules on the Terraform Registry.

Question70: You have declared a variable called var.list which is a list of objects that all have an attribute id.
Which options will produce a list of the IDs? (Choose two.)

Question71: Where does the Terraform local backend store its state?

Question72: What is the command you can use to set an environment variable named "var1"of type String?

Question73: When should you use the force-unlock command?

Question74: Terra form installs its providers during which phase?

Question75: Environment variables can be used to set variables. The environment variables must be in the format "____"_<variablename>. Select the correct prefix string from the following list.

Question76: resource "aws_s3_bucket" "example" { bucket = "my-test-s3-terraform-bucket" ...} resource "aws_iam_role"
"test_role" { name = "test_role" ...}
Due to the way that the application code is written , the s3 bucket must be created before the test role is created , otherwise there will be a problem. How can you ensure that?

Question77: Which of the following commands will launch the Interactive console for Terraform interpolations?

Question78: Environment variables can be used to set variables. The environment variables must be in the format
"____"_<variablename>. Select the correct prefix string from the following list.

Question79: Which of the following connection types are supported by the remote-exec provisioner? (select two)

Question80: If a module declares a variable with a default, that variable must also be defined within the module.

Question81: Complete the following sentence:
For local state, the workspaces are stored directly in a ___________.

Question82: By default, provisioners that fail will also cause the Terraform apply itself to error. How can you change this default behavior within a provisioner?

Question83: Which of the following is not a valid Terraform string function?

Question84: You have declared an input variable called environment in your parent module. What must you do to pass the value to a child module in the configuration?

Question85: True or False: A list(...) contain a number of values of the same type while an object(...) can contain a number of values of different types.

Question86: Examine the following Terraform configuration, which uses the data source for an AWS AMI.
What value should you enter for the ami argument in the AWS instance resource?

Question87: Which of the following value will be accepted for var1?
variable "var1" {
type = string
}

Question88: The Security Operations team of ABC Enterprise wants to mandate that all the Terraform configuration that creates an S3 bucket must have encryption feature enabled. What is the best way to achieve it?

Question89: Terraform works well in Windows but a Windows server is required.

Question90: How would you reference the "name" value of the second instance of this fictitious resource?

Question91: Which of the following best describes the default local backend?

Question92: You have recently started a new job at a retailer as an engineer. As part of this new role, you have been tasked with evaluating multiple outages that occurred during peak shopping time during the holiday season.
Your investigation found that the team is manually deploying new compute instances and configuring each compute instance manually. This has led to inconsistent configuration between each compute instance.
How would you solve this using infrastructure as code?

Question93: You just scaled your VM infrastructure and realized you set the count variable to the wrong value. You correct the value and save your change.
What do you do next to make your infrastructure match your configuration?

Question94: Given the Terraform configuration below, in which order will the resources be created?

Question95: Which argument(s) is (are) required when declaring a Terraform variable?

Question96: When using Terraform in a team it is important for everyone to be working with the same state so that operations will be applied to the same remote objects. Which of the below option is a recommended solution for this?

Question97: In terraform, most resource dependencies are handled automatically. Which of the following statements describes best how terraform resource dependencies are handled?

Question98: Which of the following command can be used to view the specified version constraints for all providers used in the current configuration.

Question99: What is the standard workflow that a developer follows while working with terraform open source version?

Question100: Which of the following allows Terraform users to apply policy as code to enforce standardized configurations for resources being deployed via infrastructure as code?

Question101: You just scaled your VM infrastructure and realized you set the count variable to the wrong value. You correct the value and save your change.
What do you do next to make your infrastructure match your configuration?

Question102: Terraform must track metadata such as resource dependencies. Where is this data stored?

Question103: Forcing the recreation of a resource is useful when you want a certain side effect of recreation that is not visible in the attributes of a resource. What command will do this?

Question104: Terraform will sync all resources in state by default for every plan and apply, hence for larger infrastructures this can slow down terraform plan and terraform apply commands?

Question105: Module version is required to reference a module on the Terraform Module Registry.

Question106: A user runs terraform init on their RHEL based server and per the output, two provider plugins are downloaded: $ terraform init Initializing the backend...
Initializing provider plugins...
- Checking for available provider plugins...
- Downloading plugin for provider "aws" (hashicorp/aws) 2.44.0...
- Downloading plugin for provider "random" (hashicorp/random) 2.2.1...
:
Terraform has been successfully initialized! Where are these plugins downloaded to?

Question107: What does the default "local" Terraform backend store?

Question108: If a DevOps team adopts AWS Cloud Formation as their standardized method for provisioning public cloud resources, which of the following scenarios poses a challenge for this team?

Question109: You have multiple team members collaborating on infrastructure as code (IaC) using Terraform, and want to apply formatting standards for readability.
How can you format Terraform HCL (HashiCorp Configuration Language) code according to standard Terraform style convention?

Question110: You have provisioned some virtual machines (VMs) on Google Cloud Platform (GCP) using the gcloud command line tool. However, you are standardizing with Terraform and want to manage these VMs using Terraform instead.
What are the two things you must do to achieve this? (Choose two.)

Question111: Provisioners should only be used as a last resort.

Question112: Examine the following Terraform configuration, which uses the data source for an AWS AMI.
What value should you enter for the ami argument in the AWS instance resource?

Question113: Why might a user opt to include the following snippet in their configuration file?

Question114: One remote backend configuration always maps to a single remote workspace.

Question115: Anyone can publish and share modules on the Terraform Public Module Registry, and meeting the requirements for publishing a module is extremely easy. Select from the following list all valid requirements. (select three)

Question116: As a developer, you want to ensure your plugins are up to date with the latest versions. Which Terraform command should you use?

Question117: What is the workflow for deploying new infrastructure with Terraform?

Question118: The current implementation of Terraform import can only import resources into the state. It does not generate configuration.

Question119: John is writing a module and within the module, there are multiple places where he has to use the same conditional expression but he wants to avoid repeating the same values or expressions multiple times in a configuration,. What is a better approach to dealing with this?

Question120: Which option can not be used to keep secrets out of Terraform configuration files?

Question121: Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged into syslog.

Question122: Which of the following command can be used to view the specified version constraints for all providers used in the current configuration.

Question123: During a terraform plan, a resource is successfully created but eventually fails during provisioning. What happens to the resource?

Question124: Terraform must track metadata such as resource dependencies. Where is this data stored?

Question125: As a member of the operations team, you need to run a script on a virtual machine created by Terraform. Which provisioned is best to use in your Terraform code?

Question126: What feature of Terraform Cloud and/or Terraform Enterprise can you publish and maintain a set of custom modules which can be used within your organization?

Question127: Terraform-specific settings and behaviors are declared in which configuration block type?

Question128: You have a simple Terraform configuration containing one virtual machine (VM) in a cloud provider. You run terraform apply and the VM is created successfully.
What will happen if you delete the VM using the cloud provider console, and run terraform apply again without changing any Terraform code?

Question129: Which of the following is not an action performed by terraform init?

Question130: Terraform has detailed logs which can be enabled by setting the _________ environmental variable.

Question131: Given the Terraform configuration below, in which order will the resources be created?

Question132: You have written a terraform IaC script which was working till yesterday , but is giving some vague error from today , which you are unable to understand . You want more detailed logs that could potentially help you troubleshoot the issue , and understand the root cause. What can you do to enable this setting? Please note , you are using terraform OSS.

Question133: Terraform-specific settings and behaviors are declared in which configuration block type?

Question134: You need to deploy resources into two different cloud regions in the same Terraform configuration. To do that, you declare multiple provider configurations as follows:

What meta-argument do you need to configure in a resource block to deploy the resource to the "us-west-2" AWS region?

Question135: Your organization has moved to AWS and has manually deployed infrastructure using the console. Recently, a decision has been made to standardize on Terraform for all deployments moving forward.
What can you do to ensure that all existing is managed by Terraform moving forward without interruption to existing services?

Question136: Provider dependencies are created in several different ways. Select the valid provider dependencies from the following list: (select three)

Question137: Which of the following is not a valid Terraform string function?

Question138: You want to use terraform import to start managing infrastructure that was not originally provisioned through infrastructure as code. Before you can import the resource's current state, what must you do in order to prepare to manage these resources using Terraform?

Question139: In regards to deploying resources in multi-cloud environments, what are some of the benefits of using Terraform rather than a provider's native tooling? (select three)

Question140: Taint the resource "aws_instance" "baz" resource that lives in module bar which lives in module foo.

Question141: Which one of the following will run echo 0 and echo 1 on a newly created host?

Question142: What value does the Terraform Cloud/Terraform Enterprise private module registry provide over the public Terraform Module Registry?

Question143: In the example below, the depends_on argument creates what type of dependency?

Question144: After running into issues with Terraform, you need to enable verbose logging to assist with troubleshooting the error. Which of the following values provides the MOST verbose logging?

Question145: Select the feature below that best completes the sentence:
The following list represents the different types of __________ available in Terraform.
1. max
2. min
3. join
4. replace
5. list
6. length
7. range

Question146: All modules published on the official Terraform Module Registry have been verified by HashiCorp.

Question147: You are using a terraform operation that writes state. Unfortunately automatic state unlocking has failed for that operation. Which of the below commands can be used to remove the already acquired lock on the state?

Question148: Anyone can publish and share modules on the Terraform Public Module Registry, and meeting the requirements for publishing a module is extremely easy. Select from the following list all valid requirements.
(select three)

Question149: You've used Terraform to deploy a virtual machine and a database. You want to replace this virtual machine instance with an identical one without affecting the database. What is the best way to achieve this using Terraform?

Question150: Terraform providers are always installed from the Internet.

Question151: What command should you run to display all workspaces for the current configuration?

Question152: ABC Enterprise has recently tied up with multiple small organizations for exchanging database information.
Due to this, the firewall rules are increasing and are more than 100 rules. This is leading firewall configuration file that is difficult to manage. What is the way this type of configuration can be managed easily?

Question153: After executing a terraform apply, you notice that a resource has a tilde (~) next to it. What does this infer?

Question154: What command should you run to display all workspaces for the current configuration?

Question155: lookup retrieves the value of a single element from which of the below data type?

Question156: You have deployed a new webapp with a public IP address on a clod provider. However, you did not create any outputs for your code.
What is the best method to quickly find the IP address of the resource you deployed?

Question157: The current implementation of Terraform import can only import resources into the state. It does not generate configuration.

Question158: What is the purpose of using the local-exec provisioner? (Select Two)

Question159: If a module uses a local variable, you can expose that value with a terraform output.

Question160: You have used Terraform to create an ephemeral development environment in the cloud and are now ready to destroy all the infrastructure described by your Terraform configuration. To be safe, you would like to first see all the infrastructure that will be deleted by Terraform.
Which command should you use to show all of the resources that will be deleted? (Choose two.)

Question161: Which of the following clouds does not have a provider maintained HashiCorp?

Question162: In order to reduce the time it takes to provision resources, Terraform uses parallelism. By default, how many resources will Terraform provision concurrently?

Question163: What is the workflow for deploying new infrastructure with Terraform?

Question164: You have created an AWS EC2 instance of type t2.micro through your terraform configuration file ec2.tf . Now you want to change the instance type from t2.micro to t2.medium. Accordingly you have changed your configuration file and and ran terraform plan. After running terraform plan you check the output and saw one instance will be updated from t2.micro --> t2.medium. After this you went to grab a coffee without running terraform apply and meanwhile a member of your team changed the instance type of that EC2 instance to t2.medium from aws console. After coming to your desk you run terraform apply. What will happen?

Question165: How is terraform import run?

Question166: Which of the following is an invalid variable name?

Question167: You have multiple team members collaborating on infrastructure as code (IaC) using Terraform, and want to apply formatting standards for readability.
How can you format Terraform HCL (HashiCorp Configuration Language) code according to standard Terraform style convention?

Question168: Which of the following can you do with terraform plan? Choose two correct answers.

Question169: What kind of resource dependency is stored in terraform.tfstate file?

Question170: Which of the below features of Terraform can be used for managing small differences between different environments which can act more like completely separate working directories.

Question171: What does terraform refresh command do?

Question172: Which one is the right way to import a local module names consul?

Question173: Which provisioner invokes a process on the resource created by Terraform?

Question174: You have to initialize a Terraform backend before it can be configured.

Question175: Terraform validate reports syntax check errors from which of the following scenarios?